UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YuovLbsa4OLDw2Ct6+J6qAVQgCVNgH47e4WJTEEWzI8=' 
WHERE 
  key_id = '1b8df75b58275365450966c21e87ca88c759d8cc87ff31e140df355e3c86d1f5' 
  AND (
    token = 'YuovLbsa4OLDw2Ct6+J6qAVQgCVNgH47e4WJTEEWzI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058