UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aY/dhgfZdJq/Azit6rvbcKz2+N/ONKDd11N801jvLv4=' 
WHERE 
  key_id = '302c79ba9322a2e38e889901a905e19f879c2dddbb2522fdb4a1f650ae858e27' 
  AND (
    token = 'aY/dhgfZdJq/Azit6rvbcKz2+N/ONKDd11N801jvLv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046