UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ErHaB6NXsr0HTKJVBl7lXTL1wFgPCyTC0rsAvjJFTSA=' 
WHERE 
  key_id = '36e2e5f2b08e581cd73685fe2f4008d4eae7d3ec5a121bcd255f43e1f94c0158' 
  AND (
    token = 'ErHaB6NXsr0HTKJVBl7lXTL1wFgPCyTC0rsAvjJFTSA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048