UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KOlnoFagY7hZuHqztDxdlA8t2Wvk73t87UF/aiq9jAY=' 
WHERE 
  key_id = '2e612900b55af7e20b9106df5f88b8ba04158222049189ae47e647a87221954c' 
  AND (
    token = 'KOlnoFagY7hZuHqztDxdlA8t2Wvk73t87UF/aiq9jAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044