UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X+5Uuf2/m+kTiSh9f0IzcBywqy7vkf19BPDQaRnIJz8=' 
WHERE 
  key_id = 'ef8b1d60f7b4abfdad7648160494fff16a69fbefb07b446b0b00835e68fb3a8d' 
  AND (
    token = 'X+5Uuf2/m+kTiSh9f0IzcBywqy7vkf19BPDQaRnIJz8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031