UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AMqY92S0R87/3DoYP3XyUb6YS9sNG+YJ3bClGSZkd+Q=' 
WHERE 
  key_id = '2717c89d2494024abf227a60e54499dedd78ca25a7d8c1d7acb2024dc49e792d' 
  AND (
    token = 'AMqY92S0R87/3DoYP3XyUb6YS9sNG+YJ3bClGSZkd+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036