UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5MOtL7YsUZ3oxNB86JRRz4CMy3ZkI+fiF46m35zclZ8=' 
WHERE 
  key_id = '80648dd6059ff224115f582d4444a31fd732d8db2f2d3bd6de5baeaa5347867b' 
  AND (
    token = '5MOtL7YsUZ3oxNB86JRRz4CMy3ZkI+fiF46m35zclZ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051