UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fAD5YsrCm/Q8UD4pMhPvbc4xNJj7z/3w14PHp0ifPeQ=' 
WHERE 
  key_id = 'fe083eded8ebd4c4f6c1d30dd9b1582e093757ad6d2ef4cd3c924c12b5bee045' 
  AND (
    token = 'fAD5YsrCm/Q8UD4pMhPvbc4xNJj7z/3w14PHp0ifPeQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032