UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nbG/oDHWxwuD0KJgv40Cq1UCG7xs6rVmJ9cJyWgLk68=' 
WHERE 
  key_id = 'e47c165417c32c550b9594db3fd4299cd598f3211fd1025e28fcc71290770399' 
  AND (
    token = 'nbG/oDHWxwuD0KJgv40Cq1UCG7xs6rVmJ9cJyWgLk68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043