UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gFS0siIVQnxWEQPx+18usFkt52bcd2/Nh78mNglRD3Y=' 
WHERE 
  key_id = '0804a3fc036a29c9b370f06fb9062bd41b15ebb0b21fd78b7605b50645dfc439' 
  AND (
    token = 'gFS0siIVQnxWEQPx+18usFkt52bcd2/Nh78mNglRD3Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021