UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yJD5iihOOxcqCrid4XtPJkOiu779apw7NOcPjL27/sA=' 
WHERE 
  key_id = 'ca17058266a703c6148939daad75ef7541fa4370d8bc7884e85a309712674d8a' 
  AND (
    token = 'yJD5iihOOxcqCrid4XtPJkOiu779apw7NOcPjL27/sA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026