UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TFmq+R2uI8wKAv8Xc9YIatap4hJamRJBA3j0V3o+aOI=' 
WHERE 
  key_id = '363a41af5281f2752d6e988013308ef16f980b26441186670a9edd5c1bbe31c7' 
  AND (
    token = 'TFmq+R2uI8wKAv8Xc9YIatap4hJamRJBA3j0V3o+aOI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028