UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'toYEL+DfVc8hbnesPMGlivy2eD/VflkRk7BkNG8AH54=' 
WHERE 
  key_id = '478e51ea12c67760c29e461339882029bf2ff66be0a917ef359d97f8e33241a0' 
  AND (
    token = 'toYEL+DfVc8hbnesPMGlivy2eD/VflkRk7BkNG8AH54=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038