UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '77biKVp1d6n7PWgcqhRNCHSJ+3bRZi6a+9Usybf5hEw=' 
WHERE 
  key_id = '5959621dd669403d378cc31198dbd0e55058c1db1b9bd05fdfa84133e77c3fa4' 
  AND (
    token = '77biKVp1d6n7PWgcqhRNCHSJ+3bRZi6a+9Usybf5hEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023