UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M4AU5RqaODeedQqYNiNn+qb0uPrnYEj++MrNnbdblXk=' 
WHERE 
  key_id = '3b0fa2be6302f1ba07387282977833e69aea1f8bafb9d63b30c243a85331cd2e' 
  AND (
    token = 'M4AU5RqaODeedQqYNiNn+qb0uPrnYEj++MrNnbdblXk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024