UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3cJBhFxyuY67niZnq2jdGEDdK7yhjb/Sr/NdAQNlCIo=' 
WHERE 
  key_id = 'e1ef2326611d6d22b88ef0906de4e495d9d91e4cc3223ec18919566922858157' 
  AND (
    token = '3cJBhFxyuY67niZnq2jdGEDdK7yhjb/Sr/NdAQNlCIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035