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

Query time 0.00043