UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2dGg7DlB8WYCQTt1kh3Lu7cB6qrBNbjGP4Wozp46Vz8=' 
WHERE 
  key_id = '4fbc88df0a3f221b635893c7376c699743352e7007204fbd716447b56618eeb7' 
  AND (
    token = '2dGg7DlB8WYCQTt1kh3Lu7cB6qrBNbjGP4Wozp46Vz8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066