UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H+JnOhDluPQWTYqPuBkcM04ZPqN0SHUQGyMProTk1ks=' 
WHERE 
  key_id = 'e56cc7a7f1b93a975b583e9cb94e7139b877684a2152e10319f56fbf9277a29a' 
  AND (
    token = 'H+JnOhDluPQWTYqPuBkcM04ZPqN0SHUQGyMProTk1ks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032