UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B9lxSG0xDNcpVgfHX/L4ue5yjChq/xZEAtDgHhNXcvA=' 
WHERE 
  key_id = 'ba5ed5fe901ecb5e1dad81477699b4f7e2d9908e44d04de3ee27a35cf6a71df7' 
  AND (
    token = 'B9lxSG0xDNcpVgfHX/L4ue5yjChq/xZEAtDgHhNXcvA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024