UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9Rzpx2+7d/Agi7gBhBWi4Ek+rKTHYw3DrNIJGWeixc0=' 
WHERE 
  key_id = 'a3f4750e874a91177caf560119383a37127a3717af5f939177b1589b07944944' 
  AND (
    token = '9Rzpx2+7d/Agi7gBhBWi4Ek+rKTHYw3DrNIJGWeixc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023