UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WafM4LxUeuoL5Pje+1wO7H8cF60tsW40/TjocuDTuZg=' 
WHERE 
  key_id = 'cc9c029d90794fe665bcae84bd61f3bbdc1f01d65a7cf5c68a2d77d0d0196d5f' 
  AND (
    token = 'WafM4LxUeuoL5Pje+1wO7H8cF60tsW40/TjocuDTuZg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025