UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e1k6+pX6ZdRoOuSOR18AanXdx9Ukw9rWQiuxVC9totQ=' 
WHERE 
  key_id = '860c4edc9819365ad65bbff65ea7514c6823c9e1e7558042349901ac09308aa2' 
  AND (
    token = 'e1k6+pX6ZdRoOuSOR18AanXdx9Ukw9rWQiuxVC9totQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031