UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CskQIb29pOE/mor/0gaXxuCCF1tXjOYnN34ZGPosV4A=' 
WHERE 
  key_id = '530261567ced426cdc5475b6e61a01b26777009288220756402d4a94a93b4305' 
  AND (
    token = 'CskQIb29pOE/mor/0gaXxuCCF1tXjOYnN34ZGPosV4A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019