UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5p8ZF4tZ9cTiezx4MMafeziVyppc8xhTGplBeur3PHc=' 
WHERE 
  key_id = '538d6b14639991cd246d38acf377b49db75877188f51cd71760b9432e130defe' 
  AND (
    token = '5p8ZF4tZ9cTiezx4MMafeziVyppc8xhTGplBeur3PHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015