UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DTmXkq+5VQni1ok1oAeBR6ibc9Fl5GVZQkyJgfscIVU=' 
WHERE 
  key_id = '0d595e4dd6a612968ec386c97613df549d11e7fab8e14f02fa810237c1b336e0' 
  AND (
    token = 'DTmXkq+5VQni1ok1oAeBR6ibc9Fl5GVZQkyJgfscIVU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036