UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gMVWnio/nFu4UUmwW0Twhx/FyDdDmWGKLDsFdXIiNsU=' 
WHERE 
  key_id = '4e7c2ba9ecf60bc28836f52e393f5df4574af052ad7a801f07fd43f44ce2b247' 
  AND (
    token = 'gMVWnio/nFu4UUmwW0Twhx/FyDdDmWGKLDsFdXIiNsU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034