UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+ltBexGPRunkBN/1w8mvpv8sLJO9onsEWnmUUjczfMs=' 
WHERE 
  key_id = '65f17044bba0b179abd42bdff1bd62545f1162e31acc40e9d0f9cfc61d9a0520' 
  AND (
    token = '+ltBexGPRunkBN/1w8mvpv8sLJO9onsEWnmUUjczfMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032