UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/29ruICR0jNCZ5C/McDGvCC2KlnQwwVGFI2fx1UFDIU=' 
WHERE 
  key_id = '1f19916dcff497f6adc1e34617d0e78ca5cb805d6d69a5ef273457fc82d2995b' 
  AND (
    token = '/29ruICR0jNCZ5C/McDGvCC2KlnQwwVGFI2fx1UFDIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048