UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/d9sWNb1u7o77drsa8dwQrl/jwnUozbVysn4slBaSDM=' 
WHERE 
  key_id = '9a6caa538d8b6e23cd161f336f4a44933fd093e56b9e13dcc804767858fbf260' 
  AND (
    token = '/d9sWNb1u7o77drsa8dwQrl/jwnUozbVysn4slBaSDM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052