UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ydSZbVFGcHilWtLBBeT7+mu6kmZWUqWH+FZQsPsKxjk=' 
WHERE 
  key_id = '03f3116c56ae216de2185efd6e1b2481b086d95050cdfa3ea0b2569ea40bbfbe' 
  AND (
    token = 'ydSZbVFGcHilWtLBBeT7+mu6kmZWUqWH+FZQsPsKxjk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048