UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pn1AJ9qMbHROyx4V48QSteLYY2QvyzILaB/UXMvQRas=' 
WHERE 
  key_id = '1a713afb11773e526856bf21c05ce047eed425a65a8faf7c353d10eb3aa550b6' 
  AND (
    token = 'Pn1AJ9qMbHROyx4V48QSteLYY2QvyzILaB/UXMvQRas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023