UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qV0PXE43alGIB+60/hRcdXOXd4kDeajQ44S9AoguBs8=' 
WHERE 
  key_id = '796cca23ce2b5680b703e915bec3f78ecbb458aa9799a2ca648078619e4341fd' 
  AND (
    token = 'qV0PXE43alGIB+60/hRcdXOXd4kDeajQ44S9AoguBs8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00011