UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TgpBP6DzSD8j85Cwxrp6lfU6q0wLVf6+t6dZUznELew=' 
WHERE 
  key_id = '05a51641578f3263b291ebd829abb23a36dd8620dd3daf0e67bc2d8917920faf' 
  AND (
    token = 'TgpBP6DzSD8j85Cwxrp6lfU6q0wLVf6+t6dZUznELew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026