UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k2kPVv7u0IIlxA6z1PoNoHtUDUQVkmaoLrhuKnXuWgY=' 
WHERE 
  key_id = '239139bd9f59987aaa745f08a6bce59e27ac089ed2474a8fb35fe3504d2c462f' 
  AND (
    token = 'k2kPVv7u0IIlxA6z1PoNoHtUDUQVkmaoLrhuKnXuWgY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037