UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8mg+HWrcFfSA26ASyo930CKrqOMG8CpOdvUeydfZlKc=' 
WHERE 
  key_id = '36b797efa507752af988ecb2669547d7012612b8ea4b134dfd630f9cd6e062de' 
  AND (
    token = '8mg+HWrcFfSA26ASyo930CKrqOMG8CpOdvUeydfZlKc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051